import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect:'/login'
    },
    ,
    {
      // 布局页面
      path: '/index',
      component: () => import('../components/Index.vue'),
      children: [
        {
          path: '/index',
          redirect: '/index/home'
        },
        {
          // 分类页面
          path: '/index/classify',
          component: () => import('../components/Classify/Index.vue')
        },
        {
          // 首页页面
          path: '/index/home',
          component: () => import('../components/Home/Index.vue')
        },
        {
          // 我的页面
          path: '/index/mine',
          component: () => import('../components/Mine/Index.vue')
        },
        {
          // 购物车页面
          path: '/index/shopcart',
          component: () => import('../components/Shopcart/Index.vue')
        }
      ]
    },
    {
      // 登录
      path: '/login',
      component: () => import('../components/Login/Index.vue')
    }
  ]
})

export default router
